import CheckStyle from './CheckStyle'
import * as actions from '../../redux/actions/CheckStyleAction'
import * as settingAction from '../../redux/actions/SettingAction'
import { SimpleType, StoreState } from '../../redux/Types'
import { Dispatch } from 'redux'
import { connect } from 'react-redux'


export function mapStateToProps({ checkStyle: { data, loading }, setting: { bands, minCategorys,categorys } }: StoreState) {
  return {
    data,
    loading,
    categorys: categorys,
    minCategorys:minCategorys,
    bands
  }
}
export function mapDispatchToProps(dispatch: Dispatch<actions.CheckStyleAction | settingAction.SettingAction>) {
  return {
    list: (data: SimpleType, page: any) => {
      dispatch(settingAction.initMinCategory())
      dispatch(actions.page(page))
      dispatch(actions.getCheckStyleList(data))
    }
  }
}
export default connect(mapStateToProps, mapDispatchToProps)(CheckStyle)